<?php
include '../class/class.user.php';
include '../class/class.kanwil.php';

if(isset($_REQUEST['aksi_get_all_kanwil'])){
	$kanwilDao=new KanwilDao();

	$kanwil=$kanwilDao->getAllKanwil();

	echo json_encode($kanwil);
}

if(isset($_REQUEST['aksi_get_kanwil'])){

	session_start();
	$id_user=$_SESSION['id_user'];

	$user=new User();

	$user->id_user=$id_user;

	$userDao=new UserDao();
	$usernya=$userDao->getUserById($user);

	$kdkanwil=$usernya['kdkanwil'];

	$kanwilDao=new KanwilDao();

	$kanwil=$kanwilDao->getKanwil($kdkanwil);

	echo json_encode($kanwil);
}

?>